/**
 * FileName: NettyTestController
 * Author: Mr.Wang
 * Date: 2025/10/16 09:26
 * Description:
 * History:
 */
package org.test.device.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.test.device.service.NettyTestService;
import org.test.device.utils.ResultData;

/**
 * 〈一句话功能简述〉<br>
 * 〈测试NettyController〉
 *
 * @author Mr.Wang
 * @create 2025/10/16
 * @since 1.0.0
 */
@Slf4j
@Tag(name = "Netty测试接口", description = "测试Netty客户端发送消息到指定设备")
@RestController
@RequestMapping("/netty/test")
public class NettyTestController {

    @Autowired
    NettyTestService nettyTestService;

    /**
     * 测试发送消息到指定设备
     *
     * @param deviceId 设备ID
     * @param message  要发送的消息
     * @return 操作结果
     * @Author Mr.Wang
     * @Date 2025/10/16 09:26
     */
    @RequestMapping("/send")
    public ResultData sendMessage(@RequestParam("deviceId") String deviceId,
                                  @RequestParam("message") String message) {
        return nettyTestService.reportDeviceData(deviceId, message);
    }
}